define(['config'],()=>{
    require(['jquery'],()=>{
        class Header{
            constructor(){
                this.loadHtml()
            }
            loadHtml(){
                
                $('header').load('/html/includes/header.html',()=>{
                        const formEle = document.querySelector('.search')
                    // console.log(formEle);
                    const keywordInput = document.querySelector('input[name="keyword"]')
                    formEle.addEventListener('submit', e => {
                      let keyword = keywordInput.value
                      e = e || window.event //事件对象
                      e.preventDefault()
                      location.href = '/html/search.html?keyword=' + keyword
                    })
                   
                    
                })
            }

           
        }
        return new Header()
    })
})